package io.gitee.chearnee.fw.sidecar.action;

import io.gitee.chearnee.fw.sidecar.common.ActionTypeEnum;
import io.gitee.chearnee.fw.sidecar.model.TrackReq;
import io.gitee.chearnee.fw.sidecar.util.IPUtils;
import io.gitee.chearnee.fw.sidecar.workshop.ActionProduce;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

/**
 * @author cn
 * @version 1.0
 * @description
 * @date 12/19/2022 11:35 AM
 */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class CustomActionHelper {
    public static void exec(String appId, String mark, ActionTypeEnum actionTypeEnum) {
        TrackReq baseClientReq = new TrackReq();
        baseClientReq.setMark(mark);
        baseClientReq.setAppId(appId);
        baseClientReq.setActionType(actionTypeEnum);
        baseClientReq.setIp(IPUtils.getRequestIPAddress());
        ActionProduce.pushAction(baseClientReq);
    }

    public static void operationExec(String appId, String mark) {
        exec(appId, mark, ActionTypeEnum.OPERATION);
    }
}
